package com.bookmngsys.dao;

import com.bookmngsys.entity.Book;
import com.bookmngsys.entity.Reservation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.ArrayList;

public interface ReservationDao extends JpaRepository<Reservation, Integer> {

    @Query(value = "select * from reservation where reader_id=:readerId", nativeQuery = true)
    ArrayList<Reservation> getByReaderId(int readerId);

    @Query(value = "select * from reservation where book_id=:bookId", nativeQuery = true)
    ArrayList<Reservation> getByBookId(String bookId);

    @Query(value = "select * from reservation where book_id=:readerId and =:isbn", nativeQuery = true)
    Reservation getByReaderIdAndIsbn(int readerId,String isbn);


}
